#include <iostream>
#include <vector>
using namespace std;

int H, W;
vector<vector<long long>> A;
long long max_xor = 0;

void dfs(int i, int j, vector<vector<bool>>& covered, long long current_xor) {
    if (i == H) {
        max_xor = max(max_xor, current_xor);
        return;
    }
    
    if (j == W) {
        dfs(i+1, 0, covered, current_xor);
        return;
    }
    
    // 当前格子已被覆盖，跳过
    if (covered[i][j]) {
        dfs(i, j+1, covered, current_xor);
        return;
    }
    
    // 情况1：不覆盖当前格子，直接异或
    dfs(i, j+1, covered, current_xor ^ A[i][j]);
    
    // 情况2：尝试水平方向多米诺
    if (j+1 < W && !covered[i][j+1]) {
        covered[i][j] = covered[i][j+1] = true;
        dfs(i, j+2, covered, current_xor);
        covered[i][j] = covered[i][j+1] = false;
    }
    
    // 情况3：尝试垂直方向多米诺
    if (i+1 < H && !covered[i+1][j]) {
        covered[i][j] = covered[i+1][j] = true;
        dfs(i, j+1, covered, current_xor);
        covered[i][j] = covered[i+1][j] = false;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> H >> W;
    A.resize(H, vector<long long>(W));
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            cin >> A[i][j];
        }
    }
    
    vector<vector<bool>> covered(H, vector<bool>(W, false));
    dfs(0, 0, covered, 0);
    
    cout << max_xor << endl;
    return 0;
}